﻿@model IEnumerable<KRM.Core.Sections>
@{
    ViewBag.Title = "Edit Feature Sections";
    Layout = "~/Views/Shared/_PopupLayout.cshtml";
}
<script>
    $(document).ready(function () {
        $("#fr-savefeaturesection").submit(function () {
            var serializedForm = $(this).serialize();
            App.blockUI($('body'));
            $.ajax({
                type: 'POST',
                url: '/products/SaveFeatureSection',
                data: serializedForm,
                success: function (data2) {
                    $("body").html(data2);
                    App.unblockUI($('body'));
                    window.opener.reloadFeatureSection();
                },
                error: function () {
                    alert('error!');
                    App.unblockUI($('body'));
                }
            });
            return false;
        });
        InitAjaxTable($(".tbl-section"));
    });
</script>
<script src="~/js/product.js"></script>
<div class="container-fluid">
    <div class="row-fluid">
        <div class="fieldset">
            <div class="legend"><span>Sections</span></div>
            <div class="row-fluid">
                <table class="table table-bordered table-fix tbl-section tbl-selected" data-height="250">
                    <thead>
                        <tr>
                            <th>SectionName</th>
                            <th>SectionTag</th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach (var item in Model)
                        {
                            <tr onclick="sectionSelected('@item.SectionID','@item.SectionName','@item.SectionTag')">
                                <td>@item.SectionName</td>
                                <td>@item.SectionTag</td>
                            </tr>
                        }
                    </tbody>
                </table>
            </div>
            <div class="row-fluid text-right" style="margin-top: 10px">
                <input type="button" class="btn btn-success" value="Add New Section" onclick="addSection();"/>
                <input type="button" class="btn btn-danger" value="Delete Section" onclick="deleteSection();"/>
            </div>
        </div>
    </div>
    <div class="row-fluid">
        <div class="fieldset">
            <div class="legend"><span>Expando Details</span></div>
            <form id="fr-savefeaturesection" style="margin-bottom: 0px;">
                <input type="hidden" name="sectionid" id="sectionid" value=""/>
                <div class="row-fluid">
                    <div class="span6">
                        <div class="span4">Section Name</div>
                        <div class="span8"><input type="text" class="input-block-level" id="sectionname" name="sectionname" value="" required="required"/></div>
                    </div>
                    <div class="span6">
                        <div class="span4">Section Tag</div>
                        <div class="span8"><input type="text" class="input-block-level" id="sectiontag" name="sectiontag" value=""/></div>
                    </div>
                </div>
                <div class="row-fluid text-right">
                    <input type="submit" class="btn btn-primary w90" value="Save"/>
                </div>
            </form>
        </div>
    </div>
</div>
